package com.kpmg.datalake.common.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.util.StringUtil;
import com.kpmg.datalake.common.dao.PrjRptSqlMpngMapper;
import com.kpmg.datalake.common.enums.UseOrDelEnum;
import com.kpmg.datalake.common.model.PrjRptSqlMpng;
import com.kpmg.datalake.common.service.IPrjRptSqlMpngService;
import com.kpmg.datalake.common.vo.GeneralHeaderVO;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 通用表头字段映射表 服务实现类
 * </p>
 *
 * @author alex [alex.zhao@kpmg.com]
 * @since 2018-07-30
 */
@Service
public class PrjRptSqlMpngServiceImpl extends ServiceImpl<PrjRptSqlMpngMapper, PrjRptSqlMpng> implements IPrjRptSqlMpngService {

    @Override
    public ArrayList<GeneralHeaderVO> selectGeneralHeader(String prjId, String rptSqlId, String locale) {
        GeneralHeaderVO generalHeaderVO = new GeneralHeaderVO();
        generalHeaderVO.setPrjId(prjId);
        generalHeaderVO.setRptSqlId(rptSqlId);
        generalHeaderVO.setDelInd(UseOrDelEnum.USE.getIntCode());
        generalHeaderVO.setLangCd(
            StringUtil.isEmpty(locale) ? Locale.SIMPLIFIED_CHINESE.toString().toLowerCase()
                : locale.toLowerCase());
        return baseMapper.selectGeneralHeader(generalHeaderVO);
    }
}
